﻿
@using System.Globalization;

<style type="text/css">
    .laytable-cell-1-AvatarPictureUrl {
        height: 100%;
        max-width: 100%;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header layuiadmin-card-header-auto">
            <form class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">昵称</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" name="SearchNickname" id="SearchNickname" placeholder="昵称" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">电话号码</label>
                        <div class="layui-input-inline">
                            <input class="layui-input" name="SearchPhone" id="SearchPhone" placeholder="电话号码" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn" lay-submit lay-filter="LAY-app-contlist-search">筛选</button>
                        <button class="layui-btn layui-btn-normal layuiadmin-btn-tags" data-type="add" style="display:none;">添加</button>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn  layui-btn-normal layuiadmin-btn-tags" lay-submit lay-filter="LAY-app-exportexcel">导出筛选数据</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="layui-card-body">
            <div class="layui-card-header">分红明细&nbsp;&nbsp;&nbsp;<a href="javascript:;" layadmin-event="back">返回</a></div>
            <table id="LAY-bonusitem-list" lay-filter="LAY-bonusitem-list"></table>
        </div>
    </div>
</div>
<script type="text/html" id="activeTpl">
    <input type="checkbox" name="Active" lay-skin="switch" value="{{d.Id}}" lay-filter="active" lay-text="激活|停用" {{ d.Active ? 'checked' : ''}}>
</script>
<script type="text/html" id="cashTpl">
    {{#  if(d.Cash){ }}
    <button class="layui-btn layui-btn-xs">已提现</button>
    {{#  } else { }}
    <button class="layui-btn layui-btn-primary layui-btn-xs">未提现</button>
    {{#  } }}
</script>
<script>
    layui.config({
        base: '../../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
        }).use(['index', 'table'], function () {
            var index = layer.load(2, { shade: false });
            var table = layui.table
                , form = layui.form;
        //分类管理
        table.render({
            elem: '#LAY-bonusitem-list'
            , url: '@Html.Raw(Url.Action("BonusItems", new { Id = ViewBag.Id }))' //模拟接口
            ,method:'post'
            , page: true //开启分页
            , even: true
            , limit: 15
            , limits: [15,30,50,100]
            , cols: [[
                { type: 'numbers' }
                , { field: 'OrderId', width: 100, title: '订单号', templet: '<div><a href="@Url.Action("Edit","Order")?id={{d.Id}}">订单信息</a></div>' }
                , { field: 'CustomerId', title: '用户编号', minWidth: 100, templet: '<div><a href="@Url.Action("Edit","Customer")?id={{d.Id}}">用户信息</a></div>' }
                , { field: 'OrderTotal', title: '订单金额', minWidth: 150 }
                , { field: 'Fee', title: '分销佣金', minWidth: 150 }
                , { field: 'Cash', title: '已提现？', templet:'#cashTpl',  width: 100, align: 'center' }
                , { field: 'Remark', title: '代理类型',width: 100, align: 'center' }
            ]]
            , text: { none: '一条数据也没有^_^' }
            , done: function () {
                layer.close(index);
            }
        });
        
        //监听搜索
         layui.form.on('submit(LAY-app-exportexcel)', function (data) {
             var field = data.field;
             window.location.href = '@Url.Action("ExportBonusExcelAll")?CustomerId=' + @ViewBag.Id
            });

        var $ = layui.$, active = { }
        $('.layui-btn.layuiadmin-btn-tags').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
    });
</script>







